package com.windchimes.edueval_platform.domain.vo;

import com.windchimes.edueval_platform.domain.po.Teacher;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 教师视图对象
 */
@Data
public class TeacherVO {

    /**
     * 教师ID
     */
    private Long id;

    /**
     * 手机号
     */
    private String phone;

    /**
     * 姓名
     */
    private String name;

    /**
     * 性别 0:女，1:男
     */
    private Integer sex;

    /**
     * 状态 0:禁用，1:正常
     */
    private Integer status;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    /**
     * 是否管理员 0-普通教师/1-管理员
     */
    private Integer isAdmin;

    /**
     * 角色类型，默认"teacher"
     */
    private String roleType = "teacher";
    /**
     * 从Teacher实体转换为TeacherVO
     */
    public static TeacherVO fromTeacher(Teacher teacher) {
        TeacherVO vo = new TeacherVO();
        vo.setId(teacher.getId());
        vo.setPhone(teacher.getPhone());
        vo.setName(teacher.getName());
        vo.setSex(teacher.getSex());
        vo.setStatus(teacher.getStatus());
        vo.setCreateTime(teacher.getCreateTime());
        vo.setUpdateTime(teacher.getUpdateTime());
        vo.setIsAdmin(teacher.getIsAdmin());
        return vo;
    }
}